#include "dialog.h"
#include <QVBoxLayout>
#include <QLabel>
#include <QPushButton>


Dialog::Dialog(QWidget* parent) : QDialog(parent)
{
    //创建出一些控件,加入到Dialog中(以Dialog作为父窗口)
    QVBoxLayout* layout = new QVBoxLayout(this);
    this->setLayout(layout);

    QLabel* label = new QLabel("这是一个对话框", this);
    QPushButton* pushButton = new QPushButton("关闭", this);
    layout->addWidget(label);
    layout->addWidget(pushButton);

    connect(pushButton, &QPushButton::clicked, this, [=](){
       this->close();
    });
}
